package com.ssmk.module.home.view;

import android.graphics.drawable.AnimationDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.liaoinstan.springview.container.BaseFooter;
import com.ssmk.R;

/**
 * 用途：
 * author：王倩凤Administrator
 * date:2017/9/5.
 */

public class Home_LoadMoreFooter extends BaseFooter{

    ImageView homeloadmore_iv;
    TextView homeloadmore_tv;
    private AnimationDrawable mBackground;

    @Override
    public View getView(LayoutInflater inflater, ViewGroup viewGroup) {

        View view = inflater.inflate(R.layout.home_loadmore, viewGroup, true);
        homeloadmore_iv = (ImageView) view.findViewById(R.id.homeloadmore_iv);
        homeloadmore_tv= (TextView) view.findViewById(R.id.homeloadmore_tv);
        homeloadmore_iv.setBackgroundResource(R.drawable.loadanim);
        mBackground = (AnimationDrawable) homeloadmore_iv.getBackground();

        return view;
    }

    @Override
    public void onPreDrag(View rootView) {

    }

    @Override
    public void onDropAnim(View rootView, int dy) {

    }

    @Override
    public void onLimitDes(View rootView, boolean upORdown) {

        if (!upORdown){
            homeloadmore_tv.setText("松开立即加载更多");
        }
        else {
            homeloadmore_tv.setText("上拉加载");
        }

    }

    @Override
    public void onStartAnim() {
        homeloadmore_tv.setText("正在加载");
        mBackground.start();

    }

    @Override
    public void onFinishAnim() {
        mBackground.stop();

    }
}
